/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vue;

import actionListeners.ActionLancerRecherche;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author Simon
 */
public class FenetreRechercherBDC extends JFrame {
    
    private JComboBox<String> site;
    private JTextField annee;
    private JTextField mois;
    private JTextField numero;
    private JTextField nomIntervenant;
    private JTextField semaine;
    private JComboBox<String> session;

    public FenetreRechercherBDC() {
        
        this.setSize(900,900);
        this.setTitle("Logiciel de gestion des bons de commande");
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        JPanel contenu = new JPanel();
        contenu.add(new PanelMenu());
        contenu.add(panelRecherche());
        this.setContentPane(contenu);
        
        
    }
    
    private JPanel panelRecherche() {
        
        JPanel panelNumero = new JPanel();
        panelNumero.add(new JLabel("Numero : "));
        try {
        this.site = new ComboBoxSites();
        panelNumero.add(site);
        } catch (Exception e){  
//            manque erreur
        }
        this.annee = new JTextField(4);
        panelNumero.add(annee);
        panelNumero.add(new JLabel("/"));
        this.mois = new JTextField(2);
        panelNumero.add(mois);
        panelNumero.add(new JLabel("/"));
        this.numero = new JTextField(4);
        panelNumero.add(numero);
        
        JPanel panelIntervenant = new JPanel();
        panelIntervenant.add(new JLabel("Nom de l'intervenant : "));
        this.nomIntervenant = new JTextField(20);
        panelIntervenant.add(nomIntervenant);
        
        JPanel panelSemaine = new JPanel();
        panelSemaine.add(new JLabel("Semaine n°: "));
        this.semaine = new JTextField(2);
        panelSemaine.add(semaine);
        
        JPanel panelSession = new JPanel();
        panelSession.add(new JLabel("Session : "));
        try {
        this.session = new ComboBoxSessions();
        panelSession.add(session);
        } catch (Exception e){  
//            manque erreur
        }
        
        JButton boutonRechercher = new JButton("Rechercher");
        boutonRechercher.addActionListener(new ActionLancerRecherche(this));
        
        JPanel panelFinal = new JPanel();
        panelFinal.add(panelNumero);
        panelFinal.add(panelIntervenant);
        panelFinal.add(panelSemaine);
        panelFinal.add(panelSession);
        panelFinal.add(boutonRechercher);
        
        return(panelFinal);
        
    }

    public JComboBox<String> getSite() {
        return site;
    }

    public JTextField getAnnee() {
        return annee;
    }

    public JTextField getMois() {
        return mois;
    }

    public JTextField getNumero() {
        return numero;
    }

    public JTextField getNomIntervenant() {
        return nomIntervenant;
    }

    public JTextField getSemaine() {
        return semaine;
    }

    public JComboBox<String> getSession() {
        return session;
    }
    
    
}
